﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.peddlerUI {
    import Events.*;
    import flash.utils.*;
    import Display.DialogUI.*;
    import org.aswing.*;
    import Classes.*;
    import Display.*;
    import flash.text.*;
    import org.aswing.event.*;
    import org.aswing.border.*;
    import Display.aswingui.*;

    public class PeddlerInputView extends GenericDialogView {

        private var m_txtArea:JTextArea;

        public function PeddlerInputView(_arg1:Dictionary, _arg2:String="", _arg3:String="", _arg4:int=0, _arg5:Function=null, _arg6:String="", _arg7:int=0, _arg8:String="", _arg9:Function=null, _arg10:String=""){
            super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
            ASwingHelper.prepare(this);
        }
        override protected function makeBackground():void{
            var _local1:MarginBackground;
            if (m_bgAsset){
                _local1 = new MarginBackground(m_bgAsset, new Insets(0, 0, 20, 0));
                this.setBackgroundDecorator(_local1);
            };
        }
        override protected function createTextArea():JPanel{
            var _local1:JPanel = new JPanel(new BorderLayout());
            _local1.append(ASwingHelper.horizontalStrut(128), BorderLayout.WEST);
            var _local2:JTextArea = this.createTextField();
            _local1.append(_local2, BorderLayout.CENTER);
            ASwingHelper.setEasyBorder(_local1, 8);
            _local1.append(ASwingHelper.horizontalStrut(40), BorderLayout.EAST);
            _local1.setPreferredWidth(this.m_bgAsset.width);
            ASwingHelper.prepare(_local1);
            return (_local1);
        }
        override protected function createTitlePanel():JPanel{
            var _local2:String;
            var _local3:TextFormat;
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            m_titleFontSize = TextFieldUtil.getLocaleFontSize(m_titleSmallCapsFontSize, m_titleFontSize, null);
            if (m_titleString != ""){
                _local2 = ZLoc.t("Dialogs", (m_titleString + "_title"));
                title = ASwingHelper.makeTextField(_local2, EmbeddedArt.TITLE_FONT, m_titleFontSize, EmbeddedArt.titleColor, 3);
                title.filters = EmbeddedArt.newtitleFilters;
                _local3 = new TextFormat();
                _local3.size = m_titleSmallCapsFontSize;
                TextFieldUtil.formatSmallCaps(title.getTextField(), _local3);
                ASwingHelper.setEasyBorder(title, 0, 50);
                _local1.append(title);
                title.getTextField().height = (m_titleFontSize * 1.5);
            } else {
                _local1.append(ASwingHelper.verticalStrut(10));
            };
            ASwingHelper.setEasyBorder(_local1, 10);
            return (_local1);
        }
        override protected function onAccept(_arg1:AWEvent):void{
            if (this.textarea.getText().length == 0){
                UI.displayMessage(ZLoc.t("Dialogs", "peddler_no_input"), 0, null, "", true);
            } else {
                dispatchEvent(new GenericPopupEvent(GenericPopupEvent.SELECTED, YES, true));
                close();
            };
        }
        protected function createTextField():JTextArea{
            this.m_txtArea = new JTextArea("");
            this.m_txtArea.setMaxChars(32);
            this.m_txtArea.setEditable(true);
            this.m_txtArea.setFont(new ASFont("_sans", 16, false, false, false));
            this.m_txtArea.getTextField().selectable = true;
            this.m_txtArea.setBackground(ASwingHelper.getWhite());
            this.m_txtArea.setBorder(new LineBorder(null, new ASColor(0xFFFFFF, 0), 0.1));
            this.m_txtArea.setPreferredHeight(60);
            this.m_txtArea.getTextField().multiline = true;
            this.m_txtArea.getTextField().wordWrap = true;
            return (this.m_txtArea);
        }
        public function get textarea():JTextArea{
            return (this.m_txtArea);
        }

    }
}//package Display.peddlerUI 
